package reflect;

import java.lang.reflect.Method;
import java.util.Scanner;
/*无参方法*/
public class reflectDemo4 {
    public static void main(String[] args) throws Exception{
        Person person = new Person();
        person.seeHello1();
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入类名");
        String clas = scanner.next();
        System.out.println("请输入方法名");
        String method = scanner.next();


        Class<?> aClass = Class.forName(clas);
        Object o = aClass.newInstance();
        Method seeHello1 = aClass.getMethod(method);
        seeHello1.invoke(o);



    }
}
